﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace NeonMika.EightTracks
{
    public class Tag
    {
        /*<tag>
            <cool-taggings-count>831</cool-taggings-count>
            <name>halloween</name>
          </tag>*/

        private int cool_taggings_count;
        private string name;

        public int CoolTaggingsCount
        {
            get { return cool_taggings_count; }
            set { cool_taggings_count = value; }
        }

        public string Name 
        {
            get { return name; }
            set { name = value; }
        }

        public Tag(XElement xml)
        {
            Name = xml.TryGetStringElement("name");
            string element = "cool_taggings_count";
            if(xml.Element(element) != null && xml.Element(element).Attribute("nil") == null)
                  CoolTaggingsCount = Convert.ToInt32(xml.Element(element).Value.ToString( ).Replace("+",""));
        }
    }
}
